<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery.livequery.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery.validate.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery.validate.extend.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/My97DatePicker/WdatePicker.js"></script>


<div class="module">
   <p class="title">车场信息
		<span class="title-tools">
	  		<a href="javascript: void(0);" class="asideBtn" onclick="javascript: getParkingList('${param.site}');">返回</a>
	  	</span>
   </p>
   
   <c:set var="readonly" />
   <c:if test="${null!=parking }">
   		<c:set value="readonly='readonly'" var="readonly"/>
   </c:if>
   
   <form id="form">
   		<div class="content">
       	   <br>
			<ul class="summary-table" style="width: 95%; margin: auto auto">
				
				<li>
					<label class="col1">名称</label> 
					<span class="col2">
						<input class="ctr-input" id="name" name="name" value="${null==parking?'':parking.name }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">地址</label> 
					<span class="col2">
						<input class="ctr-input" id="address" name="address" value="${null==parking?'':parking.address }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">联系人</label> 
					<span class="col2">
						<input class="ctr-input" id="contacts" name="contacts" value="${null==parking?'':parking.contacts }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">联系电话</label> 
					<span class="col2">
						<input class="ctr-input" id="contactNumber" name="contactNumber" value="${null==parking?'':parking.contactNumber }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">停放车种</label> 
					<span class="col2">
						<input class="ctr-input" id="parkingType" name="parkingType" value="${parking.parkingType }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">车场性质</label> 
					<span class="col2">
						<select id="nature" name="nature" class="ctr-select" >
							<option value="1" ${parking.nature==true?'selected=selected':'' }>地上</option>
							<option value="0" ${parking.nature==false?'selected=selected':'' }>地下</option>
						</select>
					</span>
				</li>
				
				<li>
					<label class="col1">车场车位总数</label> 
					<span class="col2">
						<input class="ctr-input" id="parkingTotalA" name="parkingTotalA" value="${null==parking?'':parking.parkingTotalA }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">车场大型车泊位</label> 
					<span class="col2">
						<input class="ctr-input" id="largeVehicleA" name="largeVehicleA" value="${null==parking?'':parking.largeVehicleA }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">车场小型车泊位</label> 
					<span class="col2">
						<input class="ctr-input" id="lightdutyVehicleA" name="lightdutyVehicleA" value="${null==parking?'':parking.lightdutyVehicleA }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">车场计费</label> 
					<span class="col2">
						<input class="ctr-input" id="chargingA" name="chargingA" value="${null==parking?'':parking.chargingA }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">车库车位总数</label> 
					<span class="col2">
						<input class="ctr-input" id="parkingTotalB" name="parkingTotalB" value="${null==parking?'':parking.parkingTotalB }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">车库大型车泊位</label> 
					<span class="col2">
						<input class="ctr-input" id="largeVehicleB" name="largeVehicleB" value="${null==parking?'':parking.largeVehicleB }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">车库小型车泊位</label> 
					<span class="col2">
						<input class="ctr-input" id="lightdutyVehicleB" name="lightdutyVehicleB" value="${null==parking?'':parking.lightdutyVehicleB }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">车库计费</label> 
					<span class="col2">
						<input class="ctr-input" id="chargingB" name="chargingB" value="${null==parking?'':parking.chargingB }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">是否可停放危险品</label> 
					<span class="col2">
						<select id="dangerousGoods" name="dangerousGoods" class="ctr-select" >
							<option value="1" ${parking.dangerousGoods==true?'selected=selected':'' }>是</option>
							<option value="0" ${parking.dangerousGoods==false?'selected=selected':'' }>否</option>
						</select>
					</span>
				</li>
				
				<li>
					<label class="col1">计费方式</label>
						
					<span class="col2">
						<select id="chargingMode" name="chargingMode" class="ctr-select">
							<option value="1" ${parking.chargingMode==1?'selected=selected':'' }>人工</option>
							<option value="2" ${parking.chargingMode==2?'selected=selected':'' }>自动计时自动收费</option>
							<option value="3" ${parking.chargingMode==3?'selected=selected':'' }>自动计时人工收费</option>
							<option value="4" ${parking.chargingMode==4?'selected=selected':'' }>以上混合使用</option>
						</select>
					</span>
				</li>
				
				<li>
					<label class="col1">营业时间</label> 
					<span class="col2">
						<input class="ctr-input" id="serverTime" name="serverTime" value="${null==parking?'':parking.serverTime }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">对外服务电话</label> 
					<span class="col2">
						<input class="ctr-input" id="serverHotline" name="serverHotline" value="${null==parking?'':parking.serverHotline }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">投诉电话</label> 
					<span class="col2">
						<input class="ctr-input" id="complaintsHotline" name="complaintsHotline" value="${null==parking?'':parking.complaintsHotline }" ${readonly }/>
					</span>
				</li>
				
				<li>
					<label class="col1">法人</label> 
					<span class="col2">
						<input class="ctr-input" id="corporation" name="corporation" value="${null==parking?'':parking.corporation }" ${readonly }/>
					</span>
				</li>
				
				<c:if test="${null!=parking}">
					<li>
						<label class="col1">唯一标识</label> 
						<span class="col2">
							<input class="ctr-input" id="identification" name="identification" value="${null==parking?'':parking.identification }" ${readonly }/>
						</span>
					</li>
				
					<li>
						<label class="col1">创建时间</label> 
						<span class="col2">
	                       <input class="Wdate ctr-input" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="birthdays" id="birthday" value="<fmt:formatDate value="${parking.createTime }" pattern="yyyy-MM-dd"/>" readonly="readonly"/></span></li>
	                   	</span>
					</li>
				</c:if>
				
				<li>
					<label class="col1">车场抬杆网址</label> 
					<span class="col2">
						<input class="ctr-input" id="noticeUrl" name="noticeUrl" value="${null==parking?'':parking.noticeUrl }" placeholder="http://www.xxxx.com/xxx"/>
					</span>
				</li>
			</ul>
			<c:if test="${null!=parking }">
				<input class="ctr-input" name="id" value="${parking.id }" type="hidden" />
			</c:if>
			<%-- <c:if test="${null==parking }"> --%>
				<div class="form-button-group" style="margin: auto auto">
					<span class="form-button saveBtn" id="updateSubmit">保存</span>
				</div>
			<%-- </c:if> --%>
			<br><br><br><br>
		</div>
    </form>
</div>
<script type="text/javascript">
	$('#updateSubmit').bind('click', function() {
		handleManager();
	});

	function handleManager() {
		if ($("#form").valid()) {
			$.ajax({
				type : "POST",
				url : contextPath + "/web/parkingCenter/handleManager",
				data : $("#form").serialize(),
				dataType : "json",
				beforeSend : function() {
					$("#beforeLoading").show();
				},
				success : function(res) {
					$("#beforeLoading").hide();
					if (res.resData.status) {

						succHint();

						setTimeout(function() {
							getParkingList();
						}, 2500);

					} else {
						failHint(res.msg);
					}

				},
				error : function(msg) {
					$("#beforeLoading").hide();
					failHint();
				}
			});
		}
	}
</script>

